<template>
  <div class="setting-contail">
    <van-nav-bar class="header"
                 title="设置"
                 left-arrow
                 @click-left="$router.goBack()" />
    <div class="setting-weaper">
      <van-cell-group v-for="(item,index) in menu"
                      class="fengniao-content"
                      :key="index">
        <van-cell v-for="(citem,cindex) in item"
                  :is-link="!citem.isLink"
                  :icon="citem.icon"
                  :title="citem.title"
                  :key="cindex"
                  @click="goLink(citem)" />
      </van-cell-group>
    </div>
    <van-button class="setting-logout"
                type="danger"
                @click="logout">退出系统</van-button>
  </div>
</template>

<script>
import Bus from '@/util/bus.js';
import baseCommon from '@/mixins/common';

export default {
  name: 'setting',
  mixins: [baseCommon()],
  data() {
    return {
      menu: [
        [
          {
            title: '帮助和反馈',
            icon: 'gift',
            href: 'http://qt.qq.com/php_cgi/pvp_news/html/license.html',
          },
        ],
        [
          {
            title: '检测更新',
            icon: 'gift',
            isLink: true,
            event: 'checkUpdate',
          },
          {
            title: '关于我们',
            icon: 'gift',
            href: 'http://qt.qq.com/php_cgi/pvp_news/html/license.html',
          },
        ],
      ],
    };
  },
  created() { },
  mounted() { },
  methods: {
    checkUpdate() {
      Bus.$emit('checkupdate', true);
    },
    logout() {
      this.$dialog
        .confirm({
          title: '退出',
          message: '是否退出',
        })
        .then(() => this.$store.dispatch('FedLogOut'))
        .then(() => {
          this.$router.replace({ path: '/user/index' });
        });
    },
  },
};
</script>

<style lang="scss" scoped>
.setting-logout {
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 55px;
  border-radius: 0;
}
</style>

